package com.example.gfsquadwebviewproject.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.gfsquadwebviewproject.R;
import java.util.List;

public class UpgradeAdapter extends BaseAdapter {

    Context context;
    List<String> list;

    public UpgradeAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {

        ViewHolder holder;
        if (convertView==null){
            convertView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.setting_class_name_item, null);
            holder = new ViewHolder();

            holder.tv_class_name_item_order = convertView.findViewById(R.id.tv_class_name_item_order);
            holder.tv_class_name_item_text = convertView.findViewById(R.id.tv_class_name_item_text);

            convertView.setTag(holder);
        }
        else{
            holder = (ViewHolder)convertView.getTag();
        }

        holder.tv_class_name_item_order.setText("");
        holder.tv_class_name_item_text.setText(list.get(i));

        return convertView;
    }


    class ViewHolder {
        TextView tv_class_name_item_order;
        TextView tv_class_name_item_text;
    }

}
